#define _CRT_SECURE_NO_WARNINGS 1
int* masterMind(char* solution, char* guess, int* returnSize)
{
	int* answer = (int*)malloc(sizeof(int) * 2);
	answer[0] = answer[1] = 0;

	char* p1 = solution;
	char* p2 = guess;

	for (int i = 0; i < 4; i++)
	{
		if (*p1 == *p2)
		{
			answer[0]++;
			*p1 = *p2 = 0;
		}
		p1++;
		p2++;
	}

	p1 = solution;
	p2 = guess;

	for (int i = 0; i < 4; i++)
	{
		for (int j = 0; j < 4; j++)
		{
			if (*p1 == *p2 && *p1 != 0)
			{
				answer[1]++;
				*p1 = *p2 = 0;
				break;
			}
			p1++;
		}
		p1 = solution;
		p2++;
	}

	*returnSize = 2;
	return answer;
}